package org.huawei260.TiKu.ODsuanfa;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

/**
 * @Author: qingle
 * @Date: 2024/10/28-16:11
 * @Description: 2551 【排序】2023B拔河比赛
 * @version: 1.0
 */
public class B_2023B_2551__排序拔河比赛 {
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Scanner;

//	public class Main {
		static class Employee {
			int height;
			int weight;

			public Employee(String s) {
				int[] tmp = Arrays.stream(s.split(" ")).mapToInt(Integer::parseInt).toArray();
				this.height = tmp[0];
				this.weight = tmp[1];
			}

			@Override
			public String toString() {
				return this.height + " " + this.weight;
			}
		}

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);

			ArrayList<Employee> employees = new ArrayList<>();

			// 假设题目以空行作为输入结束条件
			//    while (sc.hasNextLine()) {
			//      String line = sc.nextLine();
			//
			//      if ("".equals(line)) {
			//        getResult(employees);
			//        break;
			//      } else {
			//        employees.add(new Employee(line));
			//      }
			//    }

			// 没有额外的空行作为输入结束条件
			while (sc.hasNextLine()) {
				employees.add(new Employee(sc.nextLine()));
			}

			getResult(employees);
		}

		public static void getResult(ArrayList<Employee> employees) {
			employees.sort((a, b) -> a.height != b.height ? b.height - a.height : b.weight - a.weight);

			for (int i = 0; i < 10; i++) {
				System.out.println(employees.get(i));
			}
		}
	}